package LeetCode;

/**
 * @Author Kechelle
 * @Date 2020/9/21 17:25
 * @Version 1.0
 */
public class Code83 {

    class ListNode{
        int val;
        ListNode next;
        public ListNode(int x){
            this.val = x;
        }
    }

    public ListNode deleteDuplicates(ListNode head){
        if (head == null) return null;
        if (head.next == null) return head;
        if (head.val == head.next.val){
            head = deleteDuplicates(head.next);
        }else {
            head.next = deleteDuplicates(head.next);
        }
        return head;
    }
}
